package com.example.springcloud;

import com.example.ribbon.rules.DeptRuleConfig;
import com.example.ribbon.rules.UserRuleConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * @author 莫磊
 * @date 2025/8/20
 * @description
 */
@SpringBootApplication
@EnableDiscoveryClient()
// 开启自定义的负载均衡,RuleConfig需要放在启动类的包外面，不然的话会默认设置为所有的服务都生效
@LoadBalancerClients({
        @LoadBalancerClient(name = "DEPT-SERVICE", configuration = DeptRuleConfig.class),
        @LoadBalancerClient(name = "USER-SERVICE", configuration = UserRuleConfig.class)
})
// 开启OpenFeign,需要指定Feign客户端所在的包
@EnableFeignClients(basePackages = "com.example.api")
public class SpringCloudConsumer8002Application {

    public static void main(String[] args) {
        SpringApplication.run(SpringCloudConsumer8002Application.class, args);
    }
}
